#include "base64.h"
#include "process.h"
#include <iostream>
#include <json/json.h>
#include <string>
#include <unistd.h>
#include <pthread.h>
#include "log.h"
#include "initialization.h"
#include "ParamProcessing.h"
#include "ServerSocket.h"
#include "SocketCommunication.h"

std::string GetExecutablePath();
const std::string executablePath = GetExecutablePath();

std::string GetExecutablePath()
{
  std::string filePath(__FILE__); // 获取当前源文件的完整路径

  // 找到最后一个路径分隔符
  size_t lastSlash = filePath.find_last_of("/\\");

  // 提取路径
  if (lastSlash != std::string::npos)
  {
    return filePath.substr(0, lastSlash);
  }

  return "";
}

int main(int argc, char **argv)
{

  // 系统初始化
  if (!SystemInitialization())
  {
    return -1;
  }

  ServerSocket vision_teach(Teaching_Port);
  do
  {
    if (!vision_teach.start())
    {
      continue;
    }
    if (!vision_teach.acceptClient())
    {
      continue;
    }


  } while (true);

  return 0;
}
